/* Includes ------------------------------------------------------------------*/
#include "includes.h"

/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
	LEDInit();
	KeyInit();
	LED(0);
	WriteSeg(5);
	int num=0;
	int count1=0;
  /* Infinite loop */
  while (1)
  {
		if(KeyScan1() == KEY_ON)
		{
			count1++;
			if(count1>10)
			{
				LED(1);
				count1=0;
			}
		}
		if(KeyScan1() == KEY_OFF)
		{
			count1++;
			if(count1>10)
			{
				LED(0);
				count1=0;
			}
		}
			if(KeyScan2() == KEY_ON)
		{
			while(KeyScan2() == KEY_ON)
			{
			}
			num++;
		}
			if(KeyScan3() == KEY_ON)
		{
			while(KeyScan3() == KEY_ON)
			{
			}
				num--;
			
		}
		
		WriteSeg(num);
	
  }
}
